{extend name="common/userbase"} 
{block name="header_js"}
<link href="__STATICS__/Threelinkage/linkage.css" rel="stylesheet"  type="text/css"/>
<script src="__STATICS__/js/jquery-1.9.1.min.js" type="text/javascript"></script>
{/block}
{block name="title"}
<title>用户地址管理</title>
{/block}
{block name="content"}
<!--用户中心(地址管理界面)-->
<div class="user_style clearfix" id="user">
		<div class="user_title"><em></em>用户中心</div>
		 <div class="clearfix user" >
		   <!--左侧菜单栏样式-->
		   <div class="user_left">
			<div class="user_info">
				<div class="Head_portrait"><img src="__STATICS__/images/people.png"  width="80px" height="80px"/><!--头像区域--></div>
				<div class="user_name">{:session('nickname')}<a href="#">[个人资料]</a></div>
			</div>
			<ul class="Section">
				<li><a href="{:url('user/center')}"><em></em><span>我的特色馆</span></a></li>
				<li><a href="{:url('user/info')}"><em></em><span>完善个人信息</span></a></li>
				<li><a href="{:url('user/password')}"><em></em><span>修改密码</span></a></li>
				<li><a href="{:url('user/orders')}"><em></em><span>我的订单</span></a></li>
				<li><a href="{:url('user/message')}"><em></em><span>我的评论</span></a></li>
				<li><a href="{:url('user/integral')}"><em></em><span>我的积分</span></a></li>
				<li><a href="{:url('user/collect')}"><em></em><span>我的收藏</span></a></li>
				<li><a href="{:url('user/address')}"><em></em><span>收货地址管理</span></a></li>
			</ul>
			</div>
			<script src="__STATICS__/Threelinkage/kit.js"></script>
				<!--[if IE]>
				<script src="__STATICS__/Threelinkage/ieFix.js"></script>
				<![endif]-->
				<script type="text/javascript">
					var _gaq = _gaq || [];
					_gaq.push(['_setAccount', 'UA-30210234-1']);
					_gaq.push(['_trackPageview']);
					(function() {
						var ga = document.createElement('script');
						ga.type = 'text/javascript';
						ga.async = true;
						ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
						var s = document.getElementsByTagName('script')[0];
						s.parentNode.insertBefore(ga, s);
					})();
		
				</script>
				<script src="__STATICS__/Threelinkage/dom.js"></script>
				<script src="__STATICS__/Threelinkage/event.js"></script>
				<script src="__STATICS__/Threelinkage/math.js"></script>
				<script src="__STATICS__/Threelinkage/TreeDict.js"></script>
				<script src="__STATICS__/Threelinkage/form.js"></script>
				<script src="__STATICS__/Threelinkage/combobox.js"></script>
				<script src="__STATICS__/Threelinkage/suggestselect.js"></script>
				<script src="__STATICS__/Threelinkage/list.js"></script>
				<!--json data-->
				<script src="__STATICS__/Threelinkage/json-data.js" charset="utf-8"></script>
			<!--右侧内容样式-->
			<div class="right_style r_user_style">
			  <div class="user_Borders">
			   <div class="title_name">
				<span class="name">地址管理</span>
			   </div>
			   <div class="about_user_info">
				 <form id="form1" name="form1" method="post" action="{:url('insterAddress')}">   
			   <div class="user_layout">
				 <ul>
				  <li class="li"><label class="user_title_name">收件人姓名：</label><input name="username" type="text" class="add_text"><i>*</i></li>
				  <li class="li">
				  <div class="select">
				  <span class="select_adderss"><label> 省份 </label><select class="kitjs-form-suggestselect" name="province"></select></span>
				  <span class="select_adderss"><label> 市/县 </label><select class="kitjs-form-suggestselect" name="city"></select></span>
					<i>*</i>
				</div>   
				</li >
				  <li class="li"><label class="user_title_name">收货地址：</label><input name="address" type="text" class="add_text"><i>*</i></li>
				  <li class="li"><label class="user_title_name">邮&nbsp;&nbsp;&nbsp;&nbsp;编：</label><input name="postcodes" type="text" class="add_text"><i>*</i></li>
				  <li class="li"><label class="user_title_name">手&nbsp;机&nbsp;号：</label><input name="phone" type="text" class="add_text"><i>*</i></li>         
				 </ul>
				 <div class="operating_btn"><input name="name" type="submit" value="确认" class="submit—btn"></div>
				 </div>
				  </form>       
			   </div>
			   <!--地址列表-->
			   <div class="Address_List">
				<div class="title_name"><span class="name">用户地址列表</span></div>
				<div class="list">
				 <table>
				 <thead>
				  <td class="list_name_title0">收件人姓名</td>
				  <td class="list_name_title1">地区</td>
				  <td class="list_name_title2">邮编</td>
				  <td class="list_name_title3">电话</td>
				  <td class="list_name_title4">收货地址</td>
				  <td class="list_name_title5">操作</td>
				 </thead>        
				{foreach name="address" id="val"}
				  	<tr>
					  <td>{$val.username}</td
						><td>{$val.area}</td>
						<td>{$val.postcodes}</td>
						<td>{$val.phone}</td>
						<td>{$val.address}</td>
						<td><a href="{:url('delAddress')}?id={$val.id}">删除</a></td>
					</tr>
				{/foreach}
				 </table>
				</div>
			   </div>
			  </div>
		   </div>
		 </div>
		</div>
{/block}
{block name="footer_js"}
<script>
			var a = $kit.els8cls($kit.ui.Form.ComboBox.Select.defaultConfig.transformCls), a1 = [];
			for(var i = 0; i < a.length; i++) {
				a1.push(a[i])
			}
			a = a1;
			var b1 = new $kit.ui.Form.ComboBox.Select({
				el : a[0],
				data : (function() {
					var provTreeDict = new TreeDict();
					for(var prov in chinaJSON) {
						provTreeDict.ad(prov, prov);
					}
					return provTreeDict;
				})()
			});
			b1.transform();
			b1.ev({
				ev : 'change',
				fn : function() {
					var prov = chinaJSON[b1.inputEl.value];
					if(prov == null) {
						return;
					}
					var cityTree = new TreeDict();
					for(var city in prov) {
						cityTree.ad(city, city);
					}
					b2.inputEl.value = '';
					b2.formEl.value = '';
					b2.config.data = cityTree;
					b2.list.buildList(cityTree.search(''));
				}
			});
			var b2 = new $kit.ui.Form.ComboBox.Select({
				el : a[1],
				data : undefined
			});
			b2.transform();
			b2.ev({
				ev : 'change',
				fn : function() {
					var city = chinaJSON[b1.inputEl.value][b2.inputEl.value];
					if(city == null) {
						return;
					}
					var districtTree = new TreeDict();
					for(var district in city) {
						districtTree.ad(district, city[district]);
					}
					b3.inputEl.value = '';
					b3.formEl.value = '';
					b3.config.data = districtTree;
					b3.list.buildList(districtTree.search(''));
				}
			});
			var b3 = new $kit.ui.Form.ComboBox.Select({
				el : a[2],
				data : undefined
			});
			b3.transform();

		</script>
{/block}
